import request from '@/utils/request';
import { rsaEncrypt } from '@/utils/commonUtil3';

// 商品品牌
// 添加品牌
export function brandAdd(data) {
	const data1 = rsaEncrypt(data);
	return request({
		url: '/brand/insert',
		method: 'post',
		data: {
			data: data1
		}
	});
}
// 获取品牌列表
export function getBrand(data) {
	return request({
		url: '/brand/select',
		method: 'get',
		params: data
	});
}
// 获取品牌列表==简单
export function getBrandEasy(data) {
	return request({
		url: '/brand/selectList',
		method: 'get',
		params: data
	});
}
// 删除品牌
export function delBrand(data) {
	const data1 = rsaEncrypt(data);
	return request({
		url: '/brand/delet',
		method: 'delete',
		data: {
			data: data1
		}
	});
}

// 修改品牌
export function updateBrand(data) {
	const data1 = rsaEncrypt(data);
	return request({
		url: '/brand/update',
		method: 'put',
		data: {
			data: data1
		}
	});
}

// 商品单位
// 获取单位列表
export function getUnit(data) {
	return request({
		url: '/unit/select',
		method: 'get',
		params: data
	});
}

// 获取单位列表==简单
export function getUnitEasy(data) {
	return request({
		url: '/unit/select/all',
		method: 'get',
		params: data
	});
}

// 新增单位
export function addUnit(data) {
	const data1 = rsaEncrypt(data);
	return request({
		url: '/unit/insert',
		method: 'post',
		data: {
			data: data1
		}
	});
}

// 修改单位
export function updateUnit(data) {
	const data1 = rsaEncrypt(data);
	return request({
		url: '/unit/update',
		method: 'put',
		data: {
			data: data1
		}
	});
}

// 删除单位
export function delUnit(data) {
	const data1 = rsaEncrypt(data);
	return request({
		url: '/unit/delete',
		method: 'delete',
		data: {
			data: data1
		}
	});
}

// 商品分类
export function getCategoryList(data) {
	const data1 = rsaEncrypt(data);
	return request({
		url: '/category/select',
		method: 'get',
		data: {
			data: data1
		}
	});
}

// 商品分类
// 获取商品分类列表
export function getCategoryTreeList(data) {
	const data1 = rsaEncrypt(data);
	return request({
		url: '/category/select/tree',
		method: 'get',
		data: {
			data: data1
		}
	});
}

// 新增商品分类
export function addCategory(data) {
	const data1 = rsaEncrypt(data);
	return request({
		url: '/category/insert',
		method: 'post',
		data: {
			data: data1
		}
	});
}

// 修改商品分类
export function updateCategory(data) {
	const data1 = rsaEncrypt(data);
	return request({
		url: '/category/update',
		method: 'put',
		data: {
			data: data1
		}
	});
}

// 删除商品分类
export function delCategory(data) {
	const data1 = rsaEncrypt(data);
	return request({
		url: '/category/delete',
		method: 'delete',
		data: {
			data: data1
		}
	});
}

// 商品档案
// 获取商品档案列表
export function getGoodsList(data) {
	return request({
		url: '/commodity/select',
		method: 'get',
		params: data
	});
}
// 获取商品档案列表
export function getGoodsListC(data) {
	return request({
		url: '/commodity/selectC',
		method: 'get',
		params: data
	});
}

// 添加商品
export function addGoods(data) {
	const data1 = rsaEncrypt(data);
	return request({
		url: '/commodity/insert',
		method: 'post',
		data: {
			data: data1
		}
	});
}

// 删除商品
export function delGoods(data) {
	const data1 = rsaEncrypt(data);
	return request({
		url: '/commodity/delet',
		method: 'delete',
		data: {
			data: data1
		}
	});
}

// 查找商品详情
export function getGoodsDetail(data) {
	return request({
		url: '/commodity/selectDetails',
		method: 'get',
		params: data
	});
}

// 修改商品详情
export function updateGoodsDetail(data) {
	const data1 = rsaEncrypt(data);
	return request({
		url: '/commodity/update',
		method: 'put',
		data: {
			data: data1
		}
	});
}

// 获取未分类商品
export function selectGoodsList(data) {
	return request({
		url: '/commodity/select/category',
		method: 'get',
		params: data
	});
}

// 移动商品到指定分类下面
export function updateGoodsCategory(data) {
	const data1 = rsaEncrypt(data);
	return request({
		url: '/commodity/update/category',
		method: 'put',
		data: {
			data: data1
		}
	});
}

// 获取未分类商品数量
export function getNoGoodsCategory() {
	return request({
		url: '/category/select/noCategory',
		method: 'get'
	});
}

// 模糊查询商品
export function searchKeysGoodsList(data) {
	return request({
		url: '/commodity/selectLike',
		method: 'get',
		params: data
	});
}

// 模糊查询品牌
export function searchKeysBrandList(data) {
	return request({
		url: '/brand/selectLike',
		method: 'get',
		params: data
	});
}

// 修改商品价格
export function updateGoodsPrice(data) {
	const data1 = rsaEncrypt(data);
	return request({
		url: '/commodity/updatePrice',
		method: 'POST',
		data: {
			data: data1
		}
	});
}
